#  Copyright (c) 2020 - ~, WANGXI
#  
#  GRAMMA TEST TCL FILE
#  Used in NS-2 simulator
#  Clone from https://gitee.com/WangXi_Chn/ns2_modulelib
#  Note in https://www.yuque.com/wangxi_chn/kozrfl
#  
#  Change Logs:
#  Date           Author       Notes			Mail
#  2020-11-24     WangXi   	   first version	WangXi_Chn@foxmail.com

# 表达式 
set a 1
set b [expr {$a + 1}]

puts "b = a+1 = $b\n"

# 循环
set x 6
set y 0

while {$x!=$y} {
    puts "The value of y is $y\n"
    set y [expr $y+1]
}
puts "The end\n"

# 过程控制
proc myswitch value {
    switch $value {
        ONE {
            puts "Get a value ONE"
        }
        TWO {
            puts "Get a value TWO"
        }
        THREE {
            puts "Get a value THREE"
        }
        default {
            puts "$x is NOT A MATCH"
        }
    }
}

foreach i {ONE TWO THREE} {
    myswitch $i
}


#/************************ (C) COPYRIGHT 2020 WANGXI **************END OF FILE****/
